package levels;

import math.Vector2D;

/**
 * 16x16 tile. Empty, half-empty, or full (solid)
 * @author deep
 *
 */
public class Node 
{
	//position is the center of the square
	private Vector2D pos;
	
	public static final int WIDTH = 32;
	
	private boolean isOccupied;

	private double g, h;
	private Node expandedFrom;
	
	public Node( Vector2D loc, boolean occupied )
	{
		pos = loc;
		
		isOccupied = occupied;
	}
	
	public Vector2D getPosition()
	{
		return pos;
	}
	
	public Vector2D getTopLeftCorner()
	{
		return new Vector2D( pos.getX() - Node.WIDTH/2, pos.getY() - Node.WIDTH/2 );
	}
	
	public void setOccupied( boolean b )
	{
		isOccupied = b;
	}
	
	public boolean isOccupied()
	{
		return isOccupied;
	}
	
	//get f, g, h; set g, h
	public double getF()
	{
		return g + h;
	}
	
	public double getG()
	{
		return g;
	}
	
	public double getH()
	{
		return h;
	}
	
	public void setG( double g )
	{
		this.g = g;
	}
	
	public void setH( double h )
	{
		this.h = h;
	}
	
	//get/set expandedFrom
	public Node getExpandedFrom()
	{
		return expandedFrom;
	}
	
	public void setExpandedFrom( Node t)
	{
		expandedFrom = t;
	}
}
